package com.springboot.java0317springboot;

import com.example.iocdemo.Cpu;
import com.example.iocdemo.IntelCpu;
import com.example.iocdemo.Memory;
import com.example.iocdemo.SumsungMemory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan("com.example")
public class Java0317SpringbootApplication {

    //将返回的对象交给IOC容器
    @Qualifier("intel")
    @Bean
    public Cpu getCpu(){
        return new IntelCpu();
    }

    @Bean
    public Memory getMemory(){
        return new SumsungMemory();
    }

    public static void main(String[] args) {
        SpringApplication.run(Java0317SpringbootApplication.class, args);
    }

}
